﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using Bestlife.ERP.DataAccess;

/// <summary>
/// Summary description for D_Cart_Catogory
/// </summary>
namespace Bestlife.ERP.DataAccess
{
    public class D_Cart_Catogory
    {
        public D_Cart_Catogory()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public static List<Bestlife.ERP.Entities.E_Cart_Catogory> CatogoryNames()
        {
           
            List<Bestlife.ERP.Entities.E_Cart_Catogory> catlist = new List<Entities.E_Cart_Catogory>();
            try
            {
                string Status = "Show";
                //string catid = cat.Cat_Id1 = id;
                //Get the catogory ID and Name from the category table
                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);
                //Select Category Items from Category Table
                String Ssql = "SELECT Cat_ID,Cat_Name,Status from Tbl_Category WHERE Status='"+Status+"'";

                SqlDataReader rdR;
                rdR = clsCon.ReadTable(Ssql);
                //    //in while
                    while (rdR.Read())
                    {
                        Bestlife.ERP.Entities.E_Cart_Catogory cat = new Entities.E_Cart_Catogory();
                        cat.Cat_Id1 = rdR["Cat_ID"].ToString();
                        cat.Cat_Name1 = rdR["Cat_Name"].ToString();
                        catlist.Add(cat);
                    }
                
                rdR.Close();
            }
            catch (Exception)
            {
              
            }
            return catlist;
        }
    }
}